clc;clear;clearvars;
% 加载数据
load('isolet_X.mat', 'isolet5');
data_x = isolet5;
load('isolet_Y.mat', 'isolet5');
data_y = isolet5;

% 初始样本数100,迭代次数200,num_feature样本维度,
num_simple = 100;
num_iter = 200;
num_feature = size(data_x, 2);

% best_Z1:准确率最高的样本的特征选择情况
% best_acc1：准确率最高值
best_Z = zeros(1, num_feature);
best_acc1 = 0;
Fmin1 = zeros(num_iter, 1);
stage1 = zeros(num_iter, 1);

% 重复实验30次,在这里实验是实验一次,Fmin表示每次迭代准确率值,stage表示每次迭代选择的特征数,increment_num表示每次迭代新增评估数
[best_Zi, best_acc,Fmin, stage,increment_num] = Bi_CSO(num_simple, num_iter, num_feature, data_x, data_y);

% best_feature代表那几维适合作为选择的特征
best_feature = find(best_Zi == 1);
disp(sum(best_Zi));
disp(best_feature);
plot(stage);
plot(Fmin);
plot(increment_num);